{layout name="common/base" }
<div class="layui-form layuimini-form">
    <input type="text" hidden value="<?php echo $data['id'];?>" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label required">标题</label>
        <div class="layui-input-block" style="width: 375px;">
            <input type="text" name="name" lay-verify="required" lay-reqtext="标题不能为空" placeholder="请输入标题" value="<?php echo $data['name'];?>" class="layui-input">
            <tip>不超过4个中文</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图片</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn" id="upload_btn">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
            <div><tip>宽度750px*高度340px</tip></div>
            <img id="previewImg" width="150px" height="150px" onclick="showimg(this)" src="<?php echo config('setting.domain_prefix').config('setting.image_prefix').$data['image'];?>">
            <input id="upload_image" name="image" type="hidden" multiple="true" value="{$data.image}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="0" title="下架" <?php if($data['status'] == 0) echo 'checked="checked"';?>>
            <input type="radio" name="status" value="1" title="上架" <?php if($data['status'] == 1) echo 'checked="checked"';?>>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block" style="width: 375px;">
            <input type="number" name="sort" placeholder="请输入排序" value="<?php echo $data['sort'];?>" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>

<script type="text/javascript">
    var url = '/admin/page.nav/edit';
    add_edit(url);
    image_upload();

    /*查看图片*/
    function showimg(url) {
        var img_infor = "<img src='" + url.src + "' width='750px' height='340px'/>";
        layer.open({
            type: 1,
            closeBtn: 1,
            shade: false,
            title: false, //不显示标题
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: false,
            area:['750px','340px'],
            content: img_infor //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响

        });
    }
</script>